package com.study.java.jinjie.math;

import java.util.Random;

public class MyMath {
    public static int abs(int i){
        if (i>0) return i;
        else return -i;
    }

    public static int pow(int a,int b){
        int c=1;
        for (int i = 0; i < b; i++) {
           c=c*a;
        }
        return c;
    }


    public static void main(String[] args) {
        //System.out.println(abs(10));
        //System.out.println(abs(-30));
//        System.out.println(pow(2,3));
//        System.out.println(pow(2,10));
//        System.out.println(pow(3,3));


//        Random rand = new Random();
////
//        for (int i = 0; i < 10; i++) {
//            int num = rand.nextInt(2);
//            System.out.print(num+"  ");
//        }
//
//        System.out.println();
//
//        for (int i = 0; i < 10; i++) {
//            int num = rand.nextInt(51) + 50;
//            System.out.print(num+"  ");
//        }


        System.out.println(chi());
        System.out.println(shaize());





    }

    public static String  chi(){
        String[] fan ={"抓饭","拉面","包子","羊肉串","咖啡","五花肉", "米饭"};

        Random rand = new Random();
        int i = rand.nextInt(3);
        String zhong = fan[i];

        return zhong;
    }
    public static int shaize(){
        Random random = new Random();
        int i = random.nextInt(6)+1;
        return i;
    }

}
